import cv2
import numpy as np
import matplotlib.pyplot as plt
img = cv2.imread("img/test2.png")
# img = cv2.imread("test3.png")
cl1 = img[:, :, 0]
cl2 = img[:, :, 1]
cl3 = img[:, :, 2]

clahe = cv2.createCLAHE(20, (10, 10))
# clahe.apply 将CLAHE配置参数应用于灰度图中
hist1 = clahe.apply(cl1)
hist2 = clahe.apply(cl2)
hist3 = clahe.apply(cl3)

dist = cv2.merge((hist1, hist2, hist3))
cv2.imshow("img", img)
cv2.imshow("dist", dist)
cv2.waitKey(0)
